﻿using System;
using System.Data;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.module.user_select
{
    public partial class group : BasePage
    {
        public string strUserList;
        public group()
        {
            this.strUserList = "";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.ViewState["ToId"] = (Request.QueryString["ToId"] != null) ? Request.QueryString["ToId"].ToString() : "ToId";
            this.ViewState["ToName"] = (Request.QueryString["ToName"] != null) ? Request.QueryString["ToName"].ToString() : "ToName";
            int groupId = (Request.QueryString["group_id"] == null) ? 0 : int.Parse(Request.QueryString["group_id"].ToString());
            if (groupId != 0)
            {
                GroupDao dao = new GroupDao();
                DataTable table = dao.SelectByGroupId(base.Conn, base.User.Identity.Name, groupId);
                if (table.Rows.Count > 0)
                {
                    this.ViewState["GroupName"] = table.Rows[0]["GroupName"].ToString();
                }
                DataTable table2 = dao.SelectUserByGroupId(base.Conn, base.User.Identity.Name, groupId);
                if (table2.Rows.Count > 0)
                {
                    for (int i = 0; i < table2.Rows.Count; i++)
                    {
                        string strUserList = this.strUserList;
                        this.strUserList = strUserList + "userlist[" + i.ToString() + "]=\"" + table2.Rows[i]["UserId"].ToString() + "\";\n";
                    }
                    this.rptUsers.DataSource = table2;
                    this.rptUsers.DataBind();
                }
                else
                {
                    this.litMessage.Text = "<br><table width=\"120\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"4\" style=\"border: 1px dashed #ff6633; background-color: #EEEEEE; font-weight: bold;color: #FF6633;\" title=\"提示信息框\"><tr><td align=\"center\">未定义用户</td></tr></table><br>";
                }
            }
        }

 

 

    }
}
